var togglePanel = function() {
    /* header do panel toggleable */
    $("a.ui-panel-titlebar-icon").unbind("click");
    $(".ui-panel-titlebar").unbind("click");    
	
    $(".ui-panel-titlebar").on("click", function() {
        $(this).parent().find(".ui-panel-content").first().slideToggle();

        var panel = $(this).find(".ui-panel-titlebar-icon span");
        var plus = "ui-icon ui-icon-plusthick";
        var minus = "ui-icon ui-icon-minusthick";

        if (panel.attr("class").indexOf(plus) != -1) {
            panel.attr("class", minus);
        } else {
            panel.attr("class", plus);
        }
    });
};

$(document).ready(togglePanel);
$( document ).ajaxComplete(togglePanel);
